home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / yerk / mps231ss.hqx / Mops source / Toolbox classes / Struct1 < prev    next >
Text File  |  1993-02-01  |  1KB  |  76 lines

  1. \ Additional data structures.
  2.  
  3. \ June 91  mrh    Mops version.
  4.  
  5.  
  6. :class    WARRAY  super{ indexed-obj }  2 indexed
  7.  
  8. :m ^ELEM:    \ ( index -- addr )
  9.     inline{ ix}
  10.     ^elem2  ;m
  11.  
  12. :m AT:        \ ( index -- n )
  13.     inline{ ix w@x}
  14.     ^elem: self  w@x  ;m
  15.  
  16. :m TO:        \ ( n index -- )
  17.     inline{ ix w!}
  18.     ^elem: self  w!  ;m
  19.  
  20. :m +TO:        \ ( n index -- )
  21.     inline{ ix w+!}
  22.     ^elem: self  w+!  ;m
  23.  
  24. :m -TO:        \ ( n index -- )
  25.     inline{ ix w-!}
  26.     ^elem: self  w-!  ;m
  27.  
  28.  
  29. :m FILL:    \ ( value -- )  Fills all elements with value.
  30.     idxbase  limit 2*  bounds
  31.     ?DO  dup  i w!  2 +LOOP  drop  ;m
  32.  
  33.  
  34. :m WIDTH:    2  ;m        \ Faster than the default in Indexed-obj.
  35.  
  36. :m GETELEM:    \ ( addr -- n )  Fetches one element at addr - saves indexing
  37.         \        step if addr is known.
  38.     w@x  ;m
  39.  
  40. ;class
  41.  
  42.  
  43. :class    WORDCOL  super{ (col) wArray }
  44. ;class                    \ Yep, that's all, folks!!
  45.  
  46.  
  47. :class    BARRAY  super{ indexed-obj }  1 indexed
  48.  
  49. :m  AT:        \ ( index -- n )
  50.     inline{ ix c@}
  51.     ^elem1  c@  ;m
  52.  
  53. :m  TO:        \ ( n index -- )
  54.     inline{ ix c!}
  55.     ^elem1  c!  ;m
  56.  
  57.  
  58. :m ^ELEM:    \ ( index -- addr )
  59.     inline{ ix}
  60.     ^elem1  ;m
  61.  
  62. :m FILL:    \ ( value -- )  Fills all elements with value.
  63.     idxbase  limit 2*  bounds
  64.     ?DO  dup  i c!  LOOP  drop  ;m
  65.  
  66. :m WIDTH:    1  ;m        \ Faster than the default in Object
  67.  
  68. :m GETELEM:    \ ( addr -- n )  Fetches one element at addr
  69.     c@x  ;m
  70.  
  71. ;class
  72.  
  73.  
  74. :class    BYTECOL  super{ (col) bArray }
  75. ;class
  76.